﻿using Microsoft.SharePoint;

namespace WoltersKluwer.SPChainGang.Core.ExtensionMethods
{
    public static class ListExtensions
    {
        public static SPListItem OptimizedAddItem(this SPList list)
        {
            return list.GetItems(Constants.GlobalConstants.EmptyQuery).Add();
        }

        public static SPListItem OptimizedAddItem(this SPList list, string folderUrl, SPFileSystemObjectType fileSystemObjectType)
        {
            return list.GetItems(Constants.GlobalConstants.EmptyQuery).Add(folderUrl, fileSystemObjectType);
        }

        public static SPListItem OptimizedAddItem(this SPList list, string folderUrl, SPFileSystemObjectType fileSystemObjectType, string leafName)
        {
            return list.GetItems(Constants.GlobalConstants.EmptyQuery).Add(folderUrl, fileSystemObjectType, leafName);
        }
    }
}
